﻿using System;
using Xamarin.Essentials;

namespace TabbedTemplate.Services
{


    public class PreferenceStorage : IPreferenceStorage
    {
        /// <param name="key">Preference key.</param>
        /// <param name="value">Preference value.</param>
        /// <summary>Sets a value for a given key.</summary>
        /// <remarks> </remarks>
        public void Set(string key, double value) => Preferences.Set(key, value);
        /// <param name="key">Preference key.</param>
        /// <param name="defaultValue">Default value to return if the key does not exist.</param>
        /// <summary>Gets the value for a given key, or the default specified if the key does not exist.</summary>
        /// <returns>Value for the given key, or the default if it does not exist.</returns>
        /// <remarks />
        public double Get(string key, double defaultValue) =>
            Preferences.Get(key, defaultValue);
        public void Set(string key, DateTime value) =>
            Preferences.Set(key, value);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="key"></param>
        /// <param name="value"></param>
        public void Set(string key, string value) =>
            Preferences.Set(key, value);


        /// <summary>
        /// 
        /// </summary>
        /// <param name="key"></param>
        /// <param name="defaultValue"></param>
        /// <returns></returns>
        public string Get(string key, string defaultValue) =>
            Preferences.Get(key, defaultValue);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="key">string。</param>
        /// <param name="value">bool。</param>
        public void Set(string key, bool value) =>
            Preferences.Set(key, value);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="key"></param>
        /// <param name="defaultValue"></param>
        /// <returns></returns>
        public bool Get(string key, bool defaultValue) =>
            Preferences.Get(key, defaultValue);
        /// <param name="key">Preference key.</param>
        /// <param name="defaultValue">Default value to return if the key does not exist.</param>
        /// <summary>Gets the value for a given key, or the default specified if the key does not exist.</summary>
        /// <returns>Value for the given key, or the default if it does not exist.</returns>
        /// <remarks />
        public DateTime Get(string key, DateTime defaultValue) =>
            Preferences.Get(key, defaultValue);
    }
}
